package api

import (
	"github.com/gin-gonic/gin"
	"yuekao3/api/handler"
	"yuekao3/api/middleware"
	"yuekao3/pkg/jwt"
)

func Router(r *gin.Engine) {
	r.Use(middleware.Ampq())
	api := r.Group("/api")
	{
		user := api.Group("/user")
		{
			user.POST("/login", handler.Login)
		}
		ws := api.Group("/ws")
		{
			ws.Use(jwt.JWTAuth(handler.JWT_USER_ID))
			ws.GET("/chat", handler.Chat)
		}
		api.POST("/upload", handler.Upload)
		api.GET("/videoTable", handler.VideoTable)
		api.POST("/searchVideoTable", handler.SearchVideoTable)
		api.POST("/add", handler.Add)
	}
}
